草庐IT

windows - System.StackOverflow 错误

全部标签

使用提交哈希时 Go Modules "unknown revision"错误

我需要拉this提交到我的go项目中。我已经尝试了多个版本的go.mod:...require(github.com/libp2p/go-libp2p-core@v0.0.7-0.20190626134135-aca080dccfc2//and...github.com/libp2p/go-libp2p-corev0.0.0-20190626-aca080dccfc2c9933df66baafe6cf9cc4f429825)...两者在运行$gobuild时都会导致错误:$gobuildgo:findinggithub.com/libp2p/go-libp2p-corev0.0.0-2

sql - 如果未找到行,QueryRow().Scan() 将返回错误。怎么解决?

我花了很多时间试图解决这个问题。我有一个结构:typeTokenstruct{Id*int64`db:"id"`Email*string`db:"email"`OperationType*string`db:"operation_type"`Token*string`db:"token"`ExpirationDate*time.Time`db:"expiration_date"`}我有一个通过电子邮件找到一个token的函数:func(rRepo2)FindOneByEmail(ctxcontext.Context,emailstring,ct*Token)error{row:=r.D

go - 如何从Windows服务运行另一个可执行文件

除了关于Go的一些教程之外,我没有实际经验。我正在尝试采用Go语言编写的项目,并将其转换为Windows服务。老实说,我除了尝试找到可以阅读的东西外,没有尝试过其他任何东西。我找到了一些线程,并选择了我认为可以满足我们所有需求的最佳库https://github.com/golang/sys//Copyright2012TheGoAuthors.Allrightsreserved.//UseofthissourcecodeisgovernedbyaBSD-style//licensethatcanbefoundintheLICENSEfile.//+buildwindowspackag

go - 如何修复 VS Code 错误 : "Not able to determine import path of current package by using cwd" for Go project

我正在学习教程,我想我可能错过了一些东西。我有一个Go项目位于:/Users/just_me/development/testing/golang/example_server内容是:main.gopackagemainimport"fmt"funcmain(){fmt.Println("hiworld")}我有一个~/go目录。goenv显示:GOPATH="/Users/just_me/go"GOROOT="/usr/local/Cellar/go/1.12.9/libexec"我在VSCode中安装了建议的包。当我保存我的main.go时,我得到:Notabletodetermi

go - 错误 "protoc-gen-go: program not found or is not executable"

我正在尝试使用Go构建示例应用程序gRPC,但我无法使用“协议(protocol)”生成代码我已经使用以下方法安装了所需的库和Go包:goget-ugoogle.golang.org/grpcgoget-ugithub.com/golang/protobuf/protoc-gen-go我也试过设置路径,但没有成功。示例“原型(prototype)”文件:syntax="proto3";packagegreet;optiongo_package="greetpb";serviceGreetService{}错误信息:"protoc-gen-go:programnotfoundorisno

go - 通过 IANA 代码将 Windows 文本文件转换为 utf-8

我想使用chardet和golang.org/x/text将非utf-8文件转换为utf-8。但是,到目前为止我发现的所有代码示例都要求用户对所需的转换方向进行硬编码。例如:packagemainimport("fmt""io/ioutil""os""golang.org/x/text/encoding/charmap")funcmain(){//Writethestring//encodedtoWindows-1252encoder:=charmap.Windows1252.NewEncoder()s,e:=encoder.String("Thisissampletextwithru

go - net.Dial 在编译目标 wasm 时总是返回错误

我正在golang中设置一个连接到nodejs中的服务器的tcp客户端。golang客户端正在编译为webassembly(wasm)并通过npm的http-server命令提供服务。该程序在编译时运行良好gorunmain.go但不适用于wasm。如果我从场景中取出net.dial(...)函数,它就会工作。main.go连接的nodejs写的server//server.jsconstnet=require('net');constport=8081;consthost='127.0.0.1';constserver=net.createServer();server.listen

windows - 在 Windows 上使用 exec.Command 进行 noverify

我想使用VKCOM/noverify来分析代码。使用此命令从命令行(windowsdosshell)调用它有效noverify.exe-exclude-checksarraySyntax,phpdocLint-outputresult.txtC:\Dev\PHP\ResourceSpace_9_0_13357\include问题是我无法将参数传递给cmnd:=exec.Command("noverify.exe",args)options:="-exclude-checksarraySyntax,PHPDoc"pathToCode:="C:\\Dev\\PHP\\ResourceSpa

go - 是否可以捕获此 nil 指针错误

我有一个编译器无法发现的“nilpointer”错误,但我想看看是否有办法通过静态分析找到它。所以bug是这样的:packagemainimport("fmt")typeAstruct{namestring}funcnewGoodA()(*A,error){return&A{name:"Go",},nil}funcnewBadA()(*A,error){returnnil,fmt.Errorf("failedtocreateA")}func(a*A)greet()string{return"Hello"+a.name}funcmain(){valueA,err:=newBadA()if

windows - 命令提示符下的 Go 语言的 godoc

godocfmt此命令显示fmt包的文档。但是这个内容很多,不支持命令提示符的分页控制(/p)。godocfmt/p请告诉我如何在命令提示符下获取分页文档。 最佳答案 你可以试试这个:godocfmt|moremore不是特定于“godoc”的,应该适用于任何命令的输出。按空格键移动到下一页。 关于windows-命令提示符下的Go语言的godoc,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/qu